package com.xiaochong.tir.manager.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaochong.tir.common.data.po.SyResearchReportFile;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import com.xiaochong.tir.common.data.po.Report;
import com.xiaochong.tir.common.data.mapper.ReportMapper;
import org.springframework.transaction.annotation.Transactional;

/**
 * 此类为[基础代码]自动生成,已经拥有基本的增删改成操作 
 * <其他请自行扩展>
 * @author cx
 * @time 2018-08-09 17:37
 * 
 */
@Service
public class ReportService{
 
      
    @Autowired
	private ReportMapper reportDao;
	
	
	/**
     * 新增
     * @param entity 
     * @param session
     */
    public int insertSelective (Report entity) { 
     return this.reportDao.insertSelective(entity);
    }	
    
    /**
     * 批量新增
     * @param list 
     * @param session
     */
    public void insertBatch(List<Report> list) {
           
          this.reportDao.insertBatch(list);
         
         
    }
    
    /**
     * 根据主键修改单条数据
     * @param entity 
     * @param session
     */
    public int updateByPrimaryKey(Report entity) {
           return this.reportDao.updateByPrimaryKey(entity);
    }
    
    /**
     * 根据主键批量修改数据
     * @param list 
     * @param session
     */
    public void updateBatch(List<Report> list) {
           
          this.reportDao.updateBatch(list);
          
        
    }
    
    /**
     * 根据主键查询单条数据
     * @param id
     */
    public Report selectByPrimaryKey(Integer id) {
            return this.reportDao.selectByPrimaryKey(id);
    }
    
    /**
     * 根据条件查询单条记录
     * @param entity 
     */
    public Report selectByEntity(Report entity) {
           return this.reportDao.selectByEntity(entity);
    }
    
    
    /**
     * 根据条件查询多条记录
     * @param entity 
     */
    public List<Report> selectByEntityList(Report entity) {
           return  this.reportDao.selectByEntityList(entity);
    }
    
    /**
     * 根据条件查询Id
     * @param entity 
     */
    public Integer selectById(Report entity) {
           return  this.reportDao.selectById(entity);
    }
    
     /**
     * 根据条件查询Ids
     * @param entity 
     */
    public List<Integer> selectByIds(Report entity) {
        return  this.reportDao.selectByIds(entity);
    }
    
     /**
     * 根据主键删除单条记录
     * @param id
     */
    public void deleteByPrimaryKey(Integer id) {
           this.reportDao.deleteByPrimaryKey(id);
    }
    
    /**
     * 根据主键删除多条记录
     * @param list
     */
    public void deleteBatch(List<Integer> list) {
           this.reportDao.deleteBatch(list);
    }
    
     /**
     * 根据某些条件删除
     * @param entity
     */
    public void deleteBatch(Report entity) {
           this.reportDao.deleteByEntity(entity);
    }

    public PageInfo<Report> findList(Report report) {
        PageHelper.startPage(report.getPage(), report.getLimit());
        return new PageInfo<Report>(this.reportDao.findList(report));
    }

    @Transactional
    public void insertExcel(Report file) {
        this.reportDao.insertSelective(file);
    }
}